package com.example.acer.widgettest_118lz;

import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class NewActivity extends AppCompatActivity implements OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new);
        Intent intent=getIntent();
        String str=intent.getStringExtra("paraml");
        int n=intent.getIntExtra("param2",10);
        //在logcat中输出
        System.out.println(str+"---"+String.valueOf(n));
        //界面想显示
        Toast.makeText(this,str+"---"+String.valueOf(n), Toast.LENGTH_SHORT).show();
          //在界面上的TextView中显示
        //获取控件，设置TextView文本
         TextView tv=(TextView)findViewById(R.id.textView2);
         tv.setText(str+"---"+String.valueOf(n));
        Button btn=(Button)findViewById(R.id.button3);
        btn.setOnClickListener(this);
    }
    public  void onClick(View view){
        switch(view.getId())
        {
            case R.id.button3:
                finish();
                break;
        }
        
    }
}
